package com.gugee.tiktok.web.repository;

import com.gugee.tiktok.web.model.mysql.Blogger;
import org.springframework.data.jdbc.repository.query.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;

@Repository
public interface BloggerRepository extends CrudRepository<Blogger,Long>, BloggerExtRepository {

    // Blogger findByoUid(Long uid);

    Optional<Blogger> findById(Long id);

    @Query("SELECT * FROM blogger_main where o_uid = :id")
    Optional<Blogger> findByOUid(Long id);

    Optional<Blogger> findByoUniqueId(String uniqueId);

    @Query("SELECT * FROM blogger_main ORDER BY score DESC LIMIT :startPage,:size")
    List<Blogger> findByCountSizeOrderByScore(int startPage,int size);
}
